[[PageOutline(3-4, Sections)]] == !UploadSubtitles == === Intro === upload given subtitles to OSDb server ---- === Description === '''struct !UploadSubtitles(string $token, struct('baseinfo' => struct('idmovieimdb' => string $idmovieimdb, 'moviereleasename' => string $scene_releasename, 'movieaka' => string $aka_in_subtitle_language, 'sublanguageid' => string $sublanguageid, 'subauthorcomment' => string $author_comment), 'cd1' => struct('subhash' => string $md5subhash, 'subfilename' => string $subfilename, 'moviehash' => string $moviehash, 'moviebytesize' => double $moviebytesize, 'movietimems' => int $movietimems, 'moviefps' => double $moviefps, 'movieframes' => int $movieframes, 'moviefilename' => string $moviefilename, 'subcontent' => string $subtitlecontent), 'cd2' => struct(...)))''' This function takes care of uploading subtitles to OSDb server and should be called after [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles()]. Most of the information is the same as in [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles()], the important part is ''subcontent''. It should be gzipped (without header) and then base64-encoded contents of the subtitle file. ---- === Parameters === Parameters structure: {{{ struct( (string) [token], struct( struct( (string) [idmovieimdb], (string) [sublanguageid], (string) [moviereleasename], (string) [movieaka], (string) [subauthorcomment], ) [baseinfo], struct( (string) [subhash], (string) [subfilename], (string) [moviehash], (double) [moviebytesize], (int) [movietimems], (int) [movieframes], (double) [moviefps], (string) [moviefilename], (string) [subcontent] <-- gzipped and then base64-encoded subtitle file contents ) [cd1], struct( ... same structure as cd1 ... ) [cd2], ... more subtitle file structures go here (if any) ... ) [data] ) }}} ''token (required)'':: token string identifying user's session, taken from [wiki:XmlRpcLogIn LogIn] output structure. ''data'':: upload data structure consists of 2+ parts: basic upload information ''baseinfo'' and subtitle files ''cd1'', ''cd2'', ... ''baseinfo'':: * basic upload information structure containing: * ''idmovieimdb'': movie's IMDb ID * ''sublanguageid'': subtitle language ISO639-3 code * ''moviereleasename'': release name * ''movieaka'': optional A.K.A. movie title * ''subauthorcomment'': optional uploader's comments (insert translator credits here, etc.) ''cd1'', ''cd2'', ...:: * structure containing information about one subtitle file * mandatory fields are: ''subhash'', ''subfilename'', ''[wiki:HashSourceCodes moviehash]'', ''moviebytesize'', ''moviefilename''. * ''subhash'': MD5 hash of subtitle file contents * ''subfilename'': subtitle filename * ''moviehash'': hash calculated for the video file contents, see ''[wiki:HashSourceCodes Hash Source Codes]'' for various implementations * ''moviebytesize'': size of video file in bytes * ''movietimems'': length of video in miliseconds * ''movieframes'': length of video in frames * ''moviefps'': frame rate used in video file, e.g. 23.976 * ''moviefilename'': video filename * ''subcontent'': gzipped and then base64-encoded subtitle file contents ---- === Return Values === Output is returned in this structure: {{{ struct( (string) [status], (string) [data], (boolean) [subtitles], (double) [seconds] ) }}} and contains these elements: ''status'':: function result code, see [wiki:XmlRpcStatusCode list of status codes] ''data'':: link to subtitle on OSDb server (to be used in a web browser) ''subtitles'':: {{{ #!html